package com.ruoyi.common.apiResult;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.HashMap;

@ApiModel(description= "返回响应数据")
public class ApiRe<T> {
	@ApiModelProperty(value = "响应状态码:200成功，400错误，401未登录")
	int code =200;
	@ApiModelProperty(value = "信息")
	String msg = null;
	@ApiModelProperty(value = "返回数据")
	T data;
	private static final Object redata = new HashMap();
	public ApiRe(){
		this.code = 200;
		this.msg = "成功";
//        this.data = redata;
	}

	public ApiRe(int error){
		if(error==0){
			this.code = 401;
			this.msg = "请先登录！";
//            this.data = redata;
		}else{
			this.code = 400;
			this.msg = "系统异常，请联系开发人员！";
//            this.data = redata;
		}

	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}
}
